package com.yaowk.common.controller;

import com.jfinal.plugin.ehcache.CacheKit;
import com.yaowk.common.constant.CacheConstant;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yaowk on 17-8-20.
 */
public class IndexController extends BaseController {

    public void index() {
        redirect("/index.html");
    }

    public void clearCache() {
        CacheKit.removeAll(CacheConstant.DB);
        CacheKit.removeAll("authorizationCache");
        CacheKit.removeAll("authenticationCache");
        renderSuccess();
    }

    public void cacheKeys() {
        Map list = new HashMap();
        list.put("db", CacheKit.getKeys("db"));
        list.put("authorizationCache", CacheKit.getKeys("authorizationCache"));
        list.put("shiro-activeSessionCache", CacheKit.getKeys("shiro-activeSessionCache"));
        renderJson(list);
    }
}
